package thread;

import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.locks.Condition;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;

/**
 * Created by zhangyanfei on 2019/7/4.
 * AQS 同步器
 *
 * @author zhangyanfei
 * @date 2019/07/04
 */
public class MyLinkBlock {

    Object[] objects;

    /**
     * 锁（队列） 与 条件（队列）
     *
     * 阻塞队列
     */

    Lock lock = new ReentrantLock();

    Condition emptyCondition = lock.newCondition();

    Condition fullCondition = lock.newCondition();

    public void test() throws InterruptedException {
        // 进入等待队列
        emptyCondition.await();
        emptyCondition.signalAll();
    }

    /**
     * 写时复制
     *
     * JUC
     *
     * volatile
     *
     * Lock
     *
     * @param args
     */
    public static void main(String[] args) {
        CopyOnWriteArrayList copyOnWriteArrayList = new CopyOnWriteArrayList();
    }

}
